<template>
  <div class="profile-page">
    <van-nav-bar title="个人中心"></van-nav-bar>
    <div class="profile-info">
      <template v-if="!$store.state.user.hasPermission">
        <img src="@/assets/logo.png">
        <van-button to="/login" size="small">登录</van-button>
      </template>
      <template v-else>
        <img src="@/assets/logo.png">
        <span>{{$store.state.user.username}}</span>
      </template>
    </div>
    <div v-if="$store.state.user.menuPermission">
      <template v-for="(route, index) in $store.state.user.authList">
        <div>
          <router-link :to="route.path">{{route.name}}</router-link>
        </div>
      </template>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "index"
}
</script>

<style scoped>
.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}
</style>